<?php include view('header');?>

<div class="sideblock">
    <div class="box3 block1">
        <h1>快速查找项目</h1>
        <form action="project.php?action=search" method="post" class="simple">
            <p><label><input type="hidden" id="check_code" name="check_code" value="1" />项目代码：</label><input type="text" id="project_code" name="project_code" /></p>
            <p><label><input type="hidden" id="check_name" name="check_name" value="1" />项目名称：</label><input type="text" id="project_name" name="project_name" /></p>
            <p><label><input type="hidden" id="check_type" name="check_type" value="1" />项目类型：</label><?php echo Tpl::select('project_type', Project::$type);?></p>
            <button type="submit">搜索</button>
        </form>
    </div>
    
    <div class="box3 block2">
        <h1>快速添加项目进程</h1>
        <form action="project.php?action=addprocess" method="post" class="simple">
            <p><label>项目代码：</label><input type="text" id="process_code" name="process_code" /></p>
            <p><label>出入金额：</label><input type="text" id="process_amount" name="process_amount" /></p>
            <p><label>使用去向：</label><input type="text" id="process_reason" name="process_reason" /></p>
            <button type="submit">确认</button>
        </form>
    </div>
</div>

<div class="box3 form">
	<h1>统计信息</h1>
	<span>捐赠总金额</span><?php $amountSum=Project::amountSum();echo $amountSum; ?>
    <span>已用总金额</span><?php $useamount=$amountSum-Project::restamountSum();echo $useamount;?>
    <span>剩余总金额</span><?php echo $amountSum-$useamount;?>
</div>



<div class="sideblock">
	<div class="box2 block1">
		<h1>余额即将不足的项目</h1>
		<ul>
		<?php foreach($projectlist1 as $p){?>
			<li><a href="project.php?action=more&id=<?php echo $p['id'];?>"><?php echo $p['name'];?> （剩余<?php echo round($p['restamount'] / $p['amount'] * 10000) / 100;?>%）</a></li>
		<?php }?>
		</ul>
	</div>
	
	<div class="box2 block2">
		<h1>即将到期的项目</h1>
		<ul>
		<?php foreach($projectlist2 as $p){?>
			<li><a href="project.php?action=more&id=<?php echo $p['id'];?>"><?php echo $p['name'];?>（还有<?php echo round(($p['deadline'] - $_G['timestamp']) / 24 / 3600);?>天）</a></li>
		<?php }?>
		</ul>
	</div>
</div>

<?php if($warninglist){?>
<div class="box3 warninglist">
	<h1>系统安全警告</h1>
	<ul>
		<?php foreach($warninglist as $warning){?>
		<li><a href="<?php echo $warning['link']?>"><?php echo $warning['content'];?></a></li>
		<?php }?>
	</ul>	
</div>
<?php }?>

<?php include view('footer');?>